package com.rew.canteenbox.bases;

import android.app.Activity;

import java.util.ArrayList;
import java.util.List;

/**
 *  活动总控制.
 *  统一管理Activities.
 *
 * Created by HuiWen Ren on 2016/10/15.
 */
public class ActivityController {

    /*
     *  活动列表.
     */
    public static List<Activity> activities = new ArrayList<>();

    /*
        添加活动.
     */
    public static void addActivity(Activity activity){
        activities.add(activity);
    }

    /*
       删除活动.
    */
    public static void removeActivity(Activity activity){
        activities.remove(activity);
    }

    /*
       结束全部活动.
    */
    public static void finishAll(){
        for(Activity activity : activities){
            if(!activity.isFinishing()){
                activity.finish();
            }
        }
    }

}
